/*
 * @Author: whr2349
 * @Date: 2021-06-29 14:12:32
 * @LastEditors: whr2349
 * @LastEditTime: 2021-07-05 10:07:26
 * @Description: file content
 * @FilePath: \back\app\controller\user.js
 */
/*
 * @project-name workflow
 * @Description: 
 * @author lenovo
 * @date 2021/6/29 14:12
 * @file user
 */
"use strict";

const Controller = require('../core/BaseController')

class UserController extends Controller {
    async index() {
        const {
            ctx
        } = this;
        const param = ctx.request.query
        const total = await ctx.model.Organization.countDocuments()
        const result = await ctx.service.user.index(param.currentPage, param.pageSize)
        super.success({
            data: result,
            msg: "成功",
            total
        })
    }

    async create() {
        const {
            ctx
        } = this;
        const param = ctx.request.body
        console.log("creat user param:", param)
        const result = await ctx.model.User.create(param.data)
        console.log(result);
        super.success({
            data: result,
            msg: "成功",
        })

    }
}

module.exports = UserController;